﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VehicleScale.Models
{
    public class VehicleScaleModel : ModelBase
    {
        #region Properties
        private string _vehicleScaleID;
        public string VehicleScaleID
        {
            get { return _vehicleScaleID; }
            set
            {
                if (_vehicleScaleID != value)
                {
                    _vehicleScaleID = value;
                    IsEdit = true;
                }
            }
        }

        // Not use this variable (only get Property)
        private string _shortID;
        public string ShortID
        {
            get {
                if (String.IsNullOrEmpty(_vehicleScaleID))
                    return String.Empty;
                return _vehicleScaleID.Substring(8); }
            set
            {
                if (_shortID != value)
                {
                    _shortID = value;
                    IsEdit = true;
                }
            }
        }

        private string _customerID;
        public string CustomerID
        {
            get { return _customerID; }
            set
            {
                if (_customerID != value)
                {
                    _customerID = value;
                    IsEdit = true;
                }
            }
        }

        private string _employeeID;
        public string EmployeeID
        {
            get { return _employeeID; }
            set
            {
                if (_employeeID != value)
                {
                    _employeeID = value;
                    IsEdit = true;
                }
            }
        }

        private string _productID;
        public string ProductID
        {
            get { return _productID; }
            set
            {
                if (_productID != value)
                {
                    _productID = value;
                    IsEdit = true;
                }
            }
        }

        private int _imExType;
        public int ImExType
        {
            get { return _imExType; }
            set
            {
                if (_imExType != value)
                {
                    _imExType = value;
                    IsEdit = true;
                }
            }
        }

        //public string ImExTypeStr
        //{
        //    get
        //    {
        //        string result = String.Empty;
        //        switch (ImExType)
        //        {
        //            case 1:
        //                result = "NHẬP SẢN PHẨM (Lần 1 - Lần 2)";
        //                break;
        //            case 2:
        //                result = "XUẤT SẢN PHẨM (Lần 2 - Lần 1)";
        //                break;
        //            default:
        //                result = "LOẠI CÂN XE";
        //                break;
        //        }
        //        return result;
        //    }
        //}

        private System.DateTime _scaleDate;
        public System.DateTime ScaleDate
        {
            get { return _scaleDate; }
            set {
                if (_scaleDate != value)
                {
                    _scaleDate = value;
                    IsEdit = true;
                }
            }
        }

        private decimal _totalFirstWeight;
        public decimal TotalFirstWeight
        {
            get { return _totalFirstWeight; }
            set
            {
                if (_totalFirstWeight != value)
                {
                    _totalFirstWeight = value;
                    IsEdit = true;
                }
            }
        }

        private decimal _totalSecondWeight;
        public decimal TotalSecondWeight
        {
            get { return _totalSecondWeight; }
            set
            {
                if (_totalSecondWeight != value)
                {
                    _totalSecondWeight = value;
                    IsEdit = true;
                }
            }
        }

        public decimal TotalWeight
        {
            get { return Math.Abs(_totalSecondWeight - _totalFirstWeight); }
        }

        private string _createdByID;
        public string CreatedByID
        {
            get { return _createdByID; }
            set
            {
                if (_createdByID != value)
                {
                    _createdByID = value;
                    IsEdit = true;
                }
            }
        }

        private System.DateTime _creationDate;
        public System.DateTime CreationDate
        {
            get { return _creationDate; }
            set
            {
                if (_creationDate != value)
                {
                    _creationDate = value;
                    IsEdit = true;
                }
            }
        }

        private string _modifiedByID;
        public string ModifiedByID
        {
            get { return _modifiedByID; }
            set { 
                if(_modifiedByID != value)
                {
                    _modifiedByID = value;
                    IsEdit = true;
                }
            }
        }
        private System.DateTime _modifiedDate;
        public System.DateTime ModifiedDate
        {
            get { return _modifiedDate; }
            set
            {
                if (_modifiedDate != value)
                {
                    _modifiedDate = value;
                    IsEdit = true;
                }
            }
        }
        private bool _active;
        public bool Active
        {
            get { return _active; }
            set
            {
                if (_active != value)
                {
                    _active = value;
                    IsEdit = true;
                }
            }
        }

        private IList<VehicleScaleDetailModel> _vehicleScaleDetails = new List<VehicleScaleDetailModel>();
        public IList<VehicleScaleDetailModel> VehicleScaleDetails
        {
            get { return _vehicleScaleDetails; }
            set
            {
                if (_vehicleScaleDetails != value)
                {
                    _vehicleScaleDetails = value;
                    IsEdit = true;
                }
            }
        }

        private IList<VehicleScaleSplitModel> _vehicleScaleSplits = new List<VehicleScaleSplitModel>();
        public IList<VehicleScaleSplitModel> VehicleScaleSplits
        {
            get { return _vehicleScaleSplits; }
            set
            {
                if (_vehicleScaleSplits != value)
                {
                    _vehicleScaleSplits = value;
                    IsEdit = true;
                }
            }
        }

        private CustomerModel _customer;
        public CustomerModel Customer
        {
            get { return _customer; }
            set
            {
                if (_customer != value)
                {
                    _customer = value;
                    IsEdit = true;
                }
            }
        }

        private EmployeeModel _employee;
        public EmployeeModel Employee
        {
            get { return _employee; }
            set
            {
                if (_employee != value)
                {
                    _employee = value;
                    IsEdit = true;
                }
            }
        }

        private ProductModel _product;
        public ProductModel Product
        {
            get { return _product; }
            set
            {
                if (_product != value)
                {
                    _product = value;
                    IsEdit = true;
                }
            }
        }

        private string _categoryid;
        public string CategoryID
        {
            get { return _categoryid; }
            set
            {
                if (_categoryid != value)
                {
                    _categoryid = value;
                    IsEdit = true;
                }
            }
        }

        #endregion
    }
}
